<template>
  <div class="finance-business">
    <div class="b-query">
      <span>选择日期</span>
      <n-date-picker style="width:450px" type="daterange" clearable />
      <button class="b-query_btn b-query_btn--search">查询</button>
      <button class="b-query_btn b-query_btn--reset">重置</button>
    </div>
    <div class="b-switch">
      <span>以下收入结果包含至尊钱包支付的2500元，是否计入营业收入？</span>
      <label>
        <input type="radio" name="a" checked>
        <div class="iconfont icon-queding"></div>
        <span>计入</span>
      </label>
      <label>
        <input type="radio" name="a">
        <div class="iconfont icon-queding"></div>
        <span>不计入</span>
      </label>
    </div>
    <div class="b-statistics-card">
      <div class="c-item" v-for="(item,i) in dataList" :key="i">
        <p class="c-item_name">{{item.name}}(元)
          <span class="iconfont icon-yiwenshuoming"></span>
        </p>
        <p class="c-item_value">{{item.value}}</p>
      </div>
    </div>
    <div class="b-content">
      <div class="c-block">
        <p class="c-block_title">收入方式</p>
        <div class="c-block_header">
          <span>合计金额：￥33500</span>
        </div>
        <div class="c-block_content">
          <n-data-table :columns="incomeColumns" :data="incomeDataList" :bordered="false" />
        </div>
      </div>
      <div class="c-block">
        <p class="c-block_title">充值</p>
        <div class="c-block_header">
          <span>合计充值：￥33500</span>
          <span style="marginLeft:80px">合计赠送：￥2324</span>
        </div>
        <div class="c-block_content">
          <axq-pie :data="pieData"></axq-pie>
        </div>
      </div>
      <div class="c-block">
        <p class="c-block_title">员工收银统计</p>
        <div class="c-block_header">
          <span>销售合计金额：￥33500</span>
        </div>
        <div class="c-block_content">
          <n-data-table :columns="incomeColumns" :data="incomeDataList" :bordered="false" />
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import axqPie from '@/components/antv/pie/index.vue'

const pieData = [
  { type: '活动套餐', value: 99 },
  { type: '赠送金额', value: 25 },
];

const dataList = [
  {
    name: '总收入',
    value: 312312,
    tip: '这是总收入'
  },
  {
    name: '订单收入',
    value: 312312,
    tip: '这是总收入'
  },
  {
    name: '充值收入',
    value: 312312,
    tip: '这是总收入'
  },
  {
    name: '成本',
    value: 312312,
    tip: '这是总收入'
  },
  {
    name: '优惠金额',
    value: 312312,
    tip: '这是总收入'
  },
  {
    name: '退单',
    value: 312312,
    tip: '只统计退回的现金金额'
  },
  {
    name: '利润',
    value: 312312,
    tip: '这是总收入'
  }
]

const incomeColumns = [
  {
    title: "结账方式",
    key: "type"
  },
  {
    title: "收入合计(元)",
    key: "total"
  },
  {
    title: "营业收入(元)",
    key: "taking"
  },
  {
    title: "会员充值(元)",
    key: "topUp"
  }
]
const incomeDataList = reactive([
  { type: "微信", total: 4234, taking: 34, topUp: 2322 },
  { type: "至尊钱包", total: 4234, taking: 34, topUp: 2322 },
  { type: "支付宝", total: 4234, taking: 34, topUp: 2322 },
  { type: "现金", total: 4234, taking: 34, topUp: 2322 },
])
</script>

<style lang="less">
.finance-business {
  padding: 30px;
  .b-query {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    span {
      margin-right: 10px;
      font-size: 26px;
      font-weight: 500;
      color: #2e323d;
    }
    .b-query_btn {
      width: 114px;
      height: 60px;
      font-size: 26px;
      text-align: center;
      line-height: 60px;
      border-radius: 5px;
      &--search {
        margin: 0 20px;
        color: #fff;
        background: #1981f4;
      }
      &--reset {
        color: #4a5060;
        background: #f8f8f8;
        border: 1px solid #aaa;
      }
    }
  }
  .b-switch {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 68px;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    > span {
      font-size: 24px;
      font-weight: 500;
      color: #4a5060;
    }
    label {
      display: flex;
      align-items: center;
      margin: 20px;
      > input {
        display: block;
        width: 0;
        height: 0;
        opacity: 0;
      }
      > div {
        width: 32px;
        height: 32px;
        text-align: center;
        line-height: 32px;
        font-size: 0;
        border: 1px solid #1981f4;
        border-radius: 5px;
      }
      span {
        margin-left: 10px;
        font-size: 24px;
        color: #2e323d;
      }
      > input:checked + div {
        font-size: 24px;
        color: #fff;
        background: #1981f4;
        box-shadow: none;
      }
    }
  }
  .b-statistics-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
    .c-item {
      width: 208px;
      height: 90px;
      padding: 20px;
      background: #fff;
      border: 1px solid #e5e5e5;
      box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.1);
      border-radius: 4px;
      &_name {
        display: flex;
        align-items: center;
        font-size: 24px;
        font-weight: 500;
        color: #4a5060;
        > span {
          font-size: 32px;
          color: #feae35;
        }
      }
      &_value {
        font-size: 30px;
        font-weight: bold;
        color: #4a5060;
      }
    }
  }
  .b-content {
    display: grid;
    grid-template-columns: repeat(2, 49.5%);
    grid-gap: 30px 20px;
    .c-block {
      height: 490px;
      padding: 20px;
      background: #fff;
      box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.1);
      border-radius: 4px;
      &_title {
        position: relative;
        padding-left: 20px;
        font-size: 28px;
        font-weight: 500;
        color: #4a5060;
        &::before {
          position: absolute;
          top: 22%;
          left: 0;
          content: "";
          width: 6px;
          height: 24px;
          background: #373b4f;
        }
      }
      &_header {
        width: 100%;
        height: 74px;
        padding-left: 20px;
        margin: 20px 0;
        font-weight: bold;
        font-size: 28px;
        color: #4a5060;
        line-height: 74px;
        background: #f7f7f7;
        border-radius: 4px;
        box-sizing: border-box;
      }
    }
  }
}
</style>